﻿/**
 * @author chrisedwards
 * class uses a Singleton pattern to store all external content paths for a Flash project
 * on initialization it acquires these paths from the root timeline where they can be defined in flash vars
 */
class com.mrmny.global.FlashVars {
	
	// Static vars
	private static var _instance:FlashVars;
	
	// Static Functions
	/**
	 * @return FlashVars instance of FlashVars
	 */
	public static function get instance():FlashVars {
		if (FlashVars._instance == undefined) {
			FlashVars._instance = new FlashVars();
		}
		return FlashVars._instance;
	}
	//
	
	
	
	//Private vars
	private var _flvPath:String;
	private var _audioPath:String;
	private var _imgPath:String;
	private var _swfPath:String;
	private var _xmlPath:String;
	private var _cssPath:String;
	private var _processPath:String;
	
	//
	//Constructor
	private function FlashVars() {
		
		this._flvPath = _root.flvPath;
		this._audioPath = _root.audioPath;
		this._imgPath = _root.imgPath;
		this._swfPath = _root.swfPath;
		this._xmlPath = _root.xmlPath;
		this._cssPath = _root.cssPath;
		this._processPath = _root.processPath;
		
	}
	
	
	
	//
	//Public functions
	public function toString():String {
		
		var sReturn:String = newline + "BEGIN FlashVars.instance"+newline;
		sReturn += "processPath:"+this.processPath+newline;
		sReturn += "swfPath:"+this.swfPath+newline;
		sReturn += "imgPath:"+this.imgPath+newline;
		sReturn += "xmlPath:"+this.xmlPath+newline;
		sReturn += "cssPath:"+this.cssPath+newline;
		sReturn += "flvPath:"+this.flvPath+newline;
		sReturn += "audioPath:"+this.audioPath+newline;
		sReturn += "END FlashVars.instance"+newline;
		return sReturn;

	}
	
	//getter setters
	
	public function get flvPath():String {
		return this._flvPath;
	}
	public function get audioPath():String {
		return this._audioPath;
	}
	public function get imgPath():String {
		return this._imgPath;
	}
	public function get swfPath():String {
		return this._swfPath;
	}
	public function get xmlPath():String {
		return this._xmlPath;
	}
	public function get cssPath():String {
		return this._cssPath;
	}
	public function get processPath():String {
		return this._processPath;
	}
}
